<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>S110_nRF51822/Board/nrf6310_nrf2752/ble/ble_app_pwr_profiling/main.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('nrf6310__nrf2752_2ble_2ble__app__pwr__profiling_2main_8c.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">S110_nRF51822/Board/nrf6310_nrf2752/ble/ble_app_pwr_profiling/main.c</div>  </div>
</div>
<div class="contents">
<a href="nrf6310__nrf2752_2ble_2ble__app__pwr__profiling_2main_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.</span>
<a name="l00002"></a>00002 <span class="comment"> *</span>
<a name="l00003"></a>00003 <span class="comment"> * The information contained herein is confidential property of Nordic</span>
<a name="l00004"></a>00004 <span class="comment"> * Semiconductor ASA.Terms and conditions of usage are described in detail</span>
<a name="l00005"></a>00005 <span class="comment"> * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensees are granted free, non-transferable use of the information. NO</span>
<a name="l00008"></a>00008 <span class="comment"> * WARRANTY of ANY KIND is provided. This heading must NOT be removed from</span>
<a name="l00009"></a>00009 <span class="comment"> * the file.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * $$</span>
<a name="l00012"></a>00012 <span class="comment"> */</span>
<a name="l00013"></a>00013 
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="nordic__common_8h.html" title="Common defines and macros for firmware developed by Nordic Semiconductor.">nordic_common.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;nrf.h&quot;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;<a class="code" href="nrf__assert_8h.html" title="Utilities for verifying program logic.">nrf_assert.h</a>&quot;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &quot;nrf_error.h&quot;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;nrf51_bitfields.h&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;ble.h&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;ble_hci.h&quot;</span>  
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="ble__srv__common_8h.html">ble_srv_common.h</a>&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;<a class="code" href="ble__advdata_8h.html">ble_advdata.h</a>&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;<a class="code" href="ble__nrf6310__pins_8h.html">ble_nrf6310_pins.h</a>&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;<a class="code" href="ble__sensorsim_8h.html">ble_sensorsim.h</a>&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="ble__stack__handler_8h.html">ble_stack_handler.h</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="app__timer_8h.html">app_timer.h</a>&quot;</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="comment">// User-modifiable configuration parameters.</span>
<a name="l00047"></a>00047 <span class="comment">//      The following values shall be altered when doing power profiling.</span>
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga560763b9fb39a5ff10a86255b583acc0">00049</a> <span class="preprocessor">#define APP_CFG_NON_CONN_ADV_TIMEOUT  30                                    </span>
<a name="l00050"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga21391c876b70819800ee07cabb337448">00050</a> <span class="preprocessor">#define APP_CFG_CHAR_NOTIF_TIMEOUT    5000                                  </span>
<a name="l00051"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gadc3efc37d835db80f2359a6d24edb5d1">00051</a> <span class="preprocessor">#define APP_CFG_ADV_DATA_LEN          31                                    </span>
<a name="l00052"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">00052</a> <span class="preprocessor">#define APP_CFG_CONNECTION_INTERVAL   20                                    </span>
<a name="l00053"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">00053</a> <span class="preprocessor">#define APP_CFG_CHAR_LEN              20                                    </span>
<a name="l00055"></a>00055 <span class="preprocessor">// Fixed configuration parameters:</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="comment">//      The following parameters are not meant to be changed while using this application for power</span>
<a name="l00057"></a>00057 <span class="comment">//      profiling.</span>
<a name="l00058"></a>00058 
<a name="l00059"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaed671c6b234821122d1d5001f3c7070">00059</a> <span class="preprocessor">#define NOTIF_BUTTON_PIN_NO           NRF6310_BUTTON_0                      </span>
<a name="l00060"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga0ba1e5fcb6523111994123a3149aeabb">00060</a> <span class="preprocessor">#define NON_CONN_ADV_BUTTON_PIN_NO    NRF6310_BUTTON_1                      </span>
<a name="l00062"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga5f5a2c9450ebc584b4fe743c6b1a280b">00062</a> <span class="preprocessor">#define DEVICE_NAME                   &quot;PWR_MGMT_DEMO&quot;                       </span>
<a name="l00064"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga00094df3c7ff7f2c4f47ae51d3cfcb15">00064</a> <span class="preprocessor">#define CONNECTABLE_ADV_INTERVAL      0x0020                                </span>
<a name="l00065"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga6b8aee23a937868a6bbb2feeb08fd92e">00065</a> <span class="preprocessor">#define NON_CONNECTABLE_ADV_INTERVAL  0x00A0                                </span>
<a name="l00066"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga335fca8c939c7948f344be20f4033cfa">00066</a> <span class="preprocessor">#define CONNECTABLE_ADV_TIMEOUT       30                                    </span>
<a name="l00068"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga0c921a874ac37870fc1516ce66cd228a">00068</a> <span class="preprocessor">#define SLAVE_LATENCY                 0                                     </span>
<a name="l00069"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga799412c2b531ca347e13611e6e7523b9">00069</a> <span class="preprocessor">#define CONN_SUP_TIMEOUT              (4 * 100)                             </span>
<a name="l00071"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga499913f33cd52975862964746893c65c">00071</a> <span class="preprocessor">#define ADV_ENCODED_AD_TYPE_LEN       1                                     </span>
<a name="l00072"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gacea39bb4f33bedf27691dee46970be2b">00072</a> <span class="preprocessor">#define ADV_ENCODED_AD_TYPE_LEN_LEN   1                                     </span>
<a name="l00073"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad5d828ead699daee4e4ea6102a3d8fb7">00073</a> <span class="preprocessor">#define ADV_ENCODED_UUID_LEN          2                                     </span>
<a name="l00074"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga1f05d89a33b1cf6b00e5fd613f9bbd09">00074</a> <span class="preprocessor">#define ADV_FLAGS_LEN                 1                                     </span>
<a name="l00075"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga7856d28e6d5f09d1290fe13cf6283175">00075</a> <span class="preprocessor">#define ADV_ENCODED_FLAGS_LEN         (ADV_ENCODED_AD_TYPE_LEN +     \</span>
<a name="l00076"></a>00076 <span class="preprocessor">                                       ADV_ENCODED_AD_TYPE_LEN_LEN + \</span>
<a name="l00077"></a>00077 <span class="preprocessor">                                       ADV_FLAGS_LEN)                       </span>
<a name="l00078"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga79b025307017e3fc5661e38ee76b04fb">00078</a> <span class="preprocessor">#define ADV_MANUF_DATA_LEN            (                              \</span>
<a name="l00079"></a>00079 <span class="preprocessor">                                       APP_CFG_ADV_DATA_LEN -        \</span>
<a name="l00080"></a>00080 <span class="preprocessor">                                       (                             \</span>
<a name="l00081"></a>00081 <span class="preprocessor">                                        ADV_ENCODED_FLAGS_LEN +      \</span>
<a name="l00082"></a>00082 <span class="preprocessor">                                        (                            \</span>
<a name="l00083"></a>00083 <span class="preprocessor">                                         ADV_ENCODED_UUID_LEN +      \</span>
<a name="l00084"></a>00084 <span class="preprocessor">                                         ADV_ENCODED_AD_TYPE_LEN +   \</span>
<a name="l00085"></a>00085 <span class="preprocessor">                                         ADV_ENCODED_AD_TYPE_LEN_LEN \</span>
<a name="l00086"></a>00086 <span class="preprocessor">                                        )                            \</span>
<a name="l00087"></a>00087 <span class="preprocessor">                                       )                             \</span>
<a name="l00088"></a>00088 <span class="preprocessor">                                      )                                     </span>
<a name="l00090"></a>00090 <span class="preprocessor">#if APP_CFG_ADV_DATA_LEN &gt; BLE_GAP_ADV_MAX_SIZE</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">    #error &quot;The required advertisement data size (APP_CFG_ADV_DATA_LEN) is greater than the value allowed by stack (BLE_GAP_ADV_MAX_SIZE). Reduce the value of APP_CFG_ADV_DATA_LEN and recompile.&quot;</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="preprocessor">#endif </span>
<a name="l00093"></a>00093 <span class="preprocessor"></span>
<a name="l00094"></a>00094 <span class="comment">// Check whether the maximum characteristic length + opcode length (1) + handle length (2) is not</span>
<a name="l00095"></a>00095 <span class="comment">// greater than default MTU size.</span>
<a name="l00096"></a>00096 <span class="preprocessor">#if (APP_CFG_CHAR_LEN + 1 + 2) &gt; BLE_L2CAP_MTU_DEF</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">    #error &quot;The APP_CFG_CHAR_LEN is too large for the maximum MTU size.&quot;</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#endif </span>
<a name="l00099"></a>00099 <span class="preprocessor"></span>
<a name="l00100"></a>00100 <span class="preprocessor">#if ADV_MANUF_DATA_LEN &lt; 1</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span><span class="preprocessor">    #error &quot;The required length of manufacturer specific data computed based on the user configured values is computed to be less than 1. Consider increasing the value of APP_CFG_ADV_DATA_LEN.&quot;</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span>
<a name="l00104"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga4385d0276b988006b19c1fe08161fb7f">00104</a> <span class="preprocessor">#define COMPANY_IDENTIFIER            0x0059                                </span>
<a name="l00106"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga44a2aaf4d9ce96f1b25a577e09015ebc">00106</a> <span class="preprocessor">#define LOCAL_SERVICE_UUID            0x1523                                </span>
<a name="l00107"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf93b1cc507e504d92a6708d8aa959a31">00107</a> <span class="preprocessor">#define LOCAL_CHAR_UUID               0x1524                                </span>
<a name="l00108"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaec7f925a06b06de7081202c846b6d536">00108</a> <span class="preprocessor">#define LOCAL_VENDOR_UUID_INDEX       0                                     </span>
<a name="l00111"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gab2bc7dc71fbbcac4685881915c9ca91e">00111</a> <span class="preprocessor">static const ble_uuid128_t s_base_uuid128s[] =</span>
<a name="l00112"></a>00112 <span class="preprocessor"></span>{
<a name="l00113"></a>00113    {
<a name="l00114"></a>00114        {
<a name="l00115"></a>00115            0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15,
<a name="l00116"></a>00116            0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00
<a name="l00117"></a>00117        }
<a name="l00118"></a>00118     }
<a name="l00119"></a>00119 };
<a name="l00120"></a>00120 
<a name="l00121"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga50483ecf69a0ae87ce1a8a5e8fa73c04">00121</a> <span class="keyword">static</span> <a class="code" href="structble__gap__adv__params__t.html" title="GAP advertising parameters.">ble_gap_adv_params_t</a>     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga50483ecf69a0ae87ce1a8a5e8fa73c04">s_adv_params</a>;                               
<a name="l00122"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gabda72b268ff799e0669dc35bd53061e7">00122</a> <span class="keyword">static</span> uint8_t                  <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gabda72b268ff799e0669dc35bd53061e7">s_char_value</a>[<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">APP_CFG_CHAR_LEN</a>];             
<a name="l00123"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf2c1a985510302fbec992f686c392e3d">00123</a> <span class="keyword">static</span> uint8_t                  <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf2c1a985510302fbec992f686c392e3d">s_adv_manuf_data</a>[<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga79b025307017e3fc5661e38ee76b04fb">ADV_MANUF_DATA_LEN</a>];       
<a name="l00124"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga46f01b26e72f51c774e2bab1f9828bcc">00124</a> <span class="keyword">static</span> <a class="code" href="structble__gatts__char__handles__t.html" title="GATT Characteristic Definition Handles.">ble_gatts_char_handles_t</a> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga46f01b26e72f51c774e2bab1f9828bcc">s_char_handles</a>;                             
<a name="l00125"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">00125</a> <span class="keyword">static</span> uint16_t                 <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a> = <a class="code" href="group___b_l_e___c_o_n_n___h_a_n_d_l_e_s.html#gacf227b9b101dbcf08eccbbaba54e48f5">BLE_CONN_HANDLE_INVALID</a>;    
<a name="l00126"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga90ec27d28a69ce12e4dfac8889b64e30">00126</a> <span class="keyword">static</span> uint16_t                 <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga90ec27d28a69ce12e4dfac8889b64e30">s_service_handle</a>;                           
<a name="l00127"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf1f61dda3c80fe8ee2ffdcbf6d8c902c">00127</a> <span class="keyword">static</span> <span class="keywordtype">bool</span>                     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf1f61dda3c80fe8ee2ffdcbf6d8c902c">s_is_notifying_enabled</a> = <span class="keyword">false</span>;             
<a name="l00137"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gadec561788a76b8a63ad9663625a25d78">00137</a> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__gzll__main.html#gadec561788a76b8a63ad9663625a25d78" title="Assert macro callback function.">assert_nrf_callback</a>(uint16_t line_num, <span class="keyword">const</span> uint8_t * file_name)
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139     <span class="comment">// Copying parameters to static variables because parameters are not accessible in debugger</span>
<a name="l00140"></a>00140     <span class="keyword">static</span> <span class="keyword">volatile</span> uint8_t  s_file_name[128];
<a name="l00141"></a>00141     <span class="keyword">static</span> <span class="keyword">volatile</span> uint16_t s_line_num;
<a name="l00142"></a>00142 
<a name="l00143"></a>00143     strcpy((<span class="keywordtype">char</span> *)s_file_name, (<span class="keyword">const</span> <span class="keywordtype">char</span> *)file_name);
<a name="l00144"></a>00144     s_line_num = line_num;
<a name="l00145"></a>00145     UNUSED_VARIABLE(s_file_name);
<a name="l00146"></a>00146     UNUSED_VARIABLE(s_line_num);
<a name="l00147"></a>00147     
<a name="l00148"></a>00148     <span class="keywordflow">for</span> (;;)
<a name="l00149"></a>00149     {
<a name="l00150"></a>00150         <span class="comment">// Loop forever. On assert, the system can only recover on reset</span>
<a name="l00151"></a>00151     }
<a name="l00152"></a>00152 }
<a name="l00153"></a>00153 
<a name="l00154"></a>00154 
<a name="l00160"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga76045b247174748cfb7bbd3db14171cd">00160</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga76045b247174748cfb7bbd3db14171cd" title="Characteristic notification function.">char_notify</a>(<span class="keywordtype">void</span>)
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162     uint32_t err_code;
<a name="l00163"></a>00163     uint16_t len = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">APP_CFG_CHAR_LEN</a>;
<a name="l00164"></a>00164 
<a name="l00165"></a>00165     <span class="comment">// Send value if connected and notifying</span>
<a name="l00166"></a>00166     <span class="keywordflow">if</span> ((<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a> != <a class="code" href="group___b_l_e___c_o_n_n___h_a_n_d_l_e_s.html#gacf227b9b101dbcf08eccbbaba54e48f5">BLE_CONN_HANDLE_INVALID</a>) &amp;&amp; <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf1f61dda3c80fe8ee2ffdcbf6d8c902c">s_is_notifying_enabled</a>)
<a name="l00167"></a>00167     {
<a name="l00168"></a>00168         <a class="code" href="structble__gatts__hvx__params__t.html" title="GATT HVx parameters.">ble_gatts_hvx_params_t</a> hvx_params;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170         memset(&amp;hvx_params, 0, <span class="keyword">sizeof</span>(hvx_params));
<a name="l00171"></a>00171         len = <span class="keyword">sizeof</span>(uint8_t);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173         hvx_params.<a class="code" href="structble__gatts__hvx__params__t.html#af242d6e3b6108ea75e1eb236e94c8240">handle</a>   = s_char_handles.<a class="code" href="structble__gatts__char__handles__t.html#a61c5d051b6f79d08236fae6cf7019e75">value_handle</a>;
<a name="l00174"></a>00174         hvx_params.<a class="code" href="structble__gatts__hvx__params__t.html#a470560e997d7a639785b8b405de9df7d">indicate</a> = 0;
<a name="l00175"></a>00175         hvx_params.<a class="code" href="structble__gatts__hvx__params__t.html#ac681806181c80437cfab37335f62ff39">offset</a>   = 0;
<a name="l00176"></a>00176         hvx_params.<a class="code" href="structble__gatts__hvx__params__t.html#a05aad1ca0c545a05986893ca0e1ed34f">p_len</a>    = &amp;len;
<a name="l00177"></a>00177         hvx_params.<a class="code" href="structble__gatts__hvx__params__t.html#a8304c4af5da6e830b86d7199dc9a22e6">p_data</a>   = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gabda72b268ff799e0669dc35bd53061e7">s_char_value</a>;
<a name="l00178"></a>00178 
<a name="l00179"></a>00179         err_code = <a class="code" href="group___b_l_e___g_a_t_t_s.html#gaab41731020dbcc6b9b561d8129689308" title="Notify or Indicate an attribute value.">ble_gatts_hvx</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a>, &amp;hvx_params);
<a name="l00180"></a>00180         <span class="keywordflow">if</span> (
<a name="l00181"></a>00181             (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00182"></a>00182             &amp;&amp;
<a name="l00183"></a>00183             (err_code != <a class="code" href="group__nrf__error.html#gaf0aff2ba7864b34a36b4a96986e1851e" title="Invalid state, operation disallowed in this state.">NRF_ERROR_INVALID_STATE</a>)
<a name="l00184"></a>00184             &amp;&amp;
<a name="l00185"></a>00185             (err_code != <a class="code" href="group__ble__err.html#ga901e1bc3ccae29eff9fb31cabdbb5e02">BLE_ERROR_NO_TX_BUFFERS</a>)
<a name="l00186"></a>00186             &amp;&amp;
<a name="l00187"></a>00187             (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
<a name="l00188"></a>00188         )
<a name="l00189"></a>00189         {
<a name="l00190"></a>00190             <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00191"></a>00191         }
<a name="l00192"></a>00192     }
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 
<a name="l00202"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga1004973353f351806e42896c491a5ab2">00202</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga1004973353f351806e42896c491a5ab2" title="GAP initialization.">gap_params_init</a>(<span class="keywordtype">void</span>)
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204     uint32_t                err_code;
<a name="l00205"></a>00205     <a class="code" href="structble__gap__conn__params__t.html" title="GAP connection parameters.">ble_gap_conn_params_t</a>   gap_conn_params;
<a name="l00206"></a>00206     <a class="code" href="structble__gap__conn__sec__mode__t.html" title="GAP link requirements.">ble_gap_conn_sec_mode_t</a> sec_mode;
<a name="l00207"></a>00207 
<a name="l00208"></a>00208     <a class="code" href="group___b_l_e___g_a_p___c_o_n_n___s_e_c___m_o_d_e___s_e_t___m_a_c_r_o_s.html#ga2abd1c711d49a4d4b1ab9bf27cafffbb" title="Set sec_mode pointed to by ptr to require no protection, open link.">BLE_GAP_CONN_SEC_MODE_SET_OPEN</a>(&amp;sec_mode);
<a name="l00209"></a>00209     
<a name="l00210"></a>00210     err_code = <a class="code" href="group___b_l_e___g_a_p.html#ga7d665aa56f8d248b8779a6cf170e2052" title="Set GAP device name.">ble_gap_device_name_set</a>(&amp;sec_mode, <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga5f5a2c9450ebc584b4fe743c6b1a280b">DEVICE_NAME</a>);
<a name="l00211"></a>00211     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00212"></a>00212     {
<a name="l00213"></a>00213         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00214"></a>00214     }
<a name="l00215"></a>00215     
<a name="l00216"></a>00216     memset(&amp;gap_conn_params, 0, <span class="keyword">sizeof</span>(gap_conn_params));
<a name="l00217"></a>00217 
<a name="l00218"></a>00218     gap_conn_params.<a class="code" href="structble__gap__conn__params__t.html#ac927a642ee2203f875fcce1eabb5fa64">min_conn_interval</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">APP_CFG_CONNECTION_INTERVAL</a>;
<a name="l00219"></a>00219     gap_conn_params.<a class="code" href="structble__gap__conn__params__t.html#a0aec1884f340406a5194b772da017d7b">max_conn_interval</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">APP_CFG_CONNECTION_INTERVAL</a>;
<a name="l00220"></a>00220     gap_conn_params.<a class="code" href="structble__gap__conn__params__t.html#a39219ac00a0e8ed843ee32b9df8be11e">slave_latency</a>     = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga0c921a874ac37870fc1516ce66cd228a">SLAVE_LATENCY</a>;
<a name="l00221"></a>00221     gap_conn_params.<a class="code" href="structble__gap__conn__params__t.html#a2089e7fb26f6b24882d1437eb5553bc7">conn_sup_timeout</a>  = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga799412c2b531ca347e13611e6e7523b9">CONN_SUP_TIMEOUT</a>;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     err_code = <a class="code" href="group___b_l_e___g_a_p.html#ga28e0062141d77d7b2272fc3a6b6e17c5" title="Set GAP Peripheral Preferred Connection Parameters.">ble_gap_ppcp_set</a>(&amp;gap_conn_params);
<a name="l00224"></a>00224     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00225"></a>00225     {
<a name="l00226"></a>00226         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00227"></a>00227     }
<a name="l00228"></a>00228 }
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 
<a name="l00237"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga934bcce661439fc90412ca1db063b4b7">00237</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga934bcce661439fc90412ca1db063b4b7" title="Connectable advertisement parameters init function.">connectable_adv_init</a>(<span class="keywordtype">void</span>)
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239     <span class="comment">// Initialise advertising parameters (used when starting advertising)</span>
<a name="l00240"></a>00240     memset(&amp;s_adv_params, 0, <span class="keyword">sizeof</span>(s_adv_params));
<a name="l00241"></a>00241     
<a name="l00242"></a>00242     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a>        = <a class="code" href="group___b_l_e___g_a_p___a_d_v___t_y_p_e_s.html#ga6cc0db53453977ee0a31e59f07de2b86">BLE_GAP_ADV_TYPE_ADV_IND</a> ;
<a name="l00243"></a>00243     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a27909d1b865548f236a871af2b6aa584">p_peer_addr</a> = NULL;                               <span class="comment">// Undirected advertisement</span>
<a name="l00244"></a>00244     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#aefdab55ee0f22565a03a14d09cc71d12">fp</a>          = <a class="code" href="group___b_l_e___g_a_p___a_d_v___f_i_l_t_e_r___p_o_l_i_c_i_e_s.html#ga0b0393df73db101d6cbfaede2dbb7ea6">BLE_GAP_ADV_FP_ANY</a>;
<a name="l00245"></a>00245     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a6c52a3d605c056768b59164ce8df8334">interval</a>    = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga00094df3c7ff7f2c4f47ae51d3cfcb15">CONNECTABLE_ADV_INTERVAL</a>;
<a name="l00246"></a>00246     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a7f1ad43d3bf79b40bc39dbb5a6c3a5ae">timeout</a>     = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga335fca8c939c7948f344be20f4033cfa">CONNECTABLE_ADV_TIMEOUT</a>;
<a name="l00247"></a>00247 }
<a name="l00248"></a>00248 
<a name="l00249"></a>00249 
<a name="l00256"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga23b9d2f8790845fdf3dc42fefca65e85">00256</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga23b9d2f8790845fdf3dc42fefca65e85" title="Non-Connectable advertisement parameters init function.">non_connectable_adv_init</a>(<span class="keywordtype">void</span>)
<a name="l00257"></a>00257 {
<a name="l00258"></a>00258     <span class="comment">// Initialise advertising parameters (used when starting advertising)</span>
<a name="l00259"></a>00259     memset(&amp;s_adv_params, 0, <span class="keyword">sizeof</span>(s_adv_params));
<a name="l00260"></a>00260 
<a name="l00261"></a>00261     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a>        = <a class="code" href="group___b_l_e___g_a_p___a_d_v___t_y_p_e_s.html#ga8c86ca45ebffc3938fd97f9556daa49c">BLE_GAP_ADV_TYPE_ADV_NONCONN_IND</a>;
<a name="l00262"></a>00262     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a27909d1b865548f236a871af2b6aa584">p_peer_addr</a> = NULL;                               <span class="comment">// Undirected advertisement</span>
<a name="l00263"></a>00263     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#aefdab55ee0f22565a03a14d09cc71d12">fp</a>          = <a class="code" href="group___b_l_e___g_a_p___a_d_v___f_i_l_t_e_r___p_o_l_i_c_i_e_s.html#ga0b0393df73db101d6cbfaede2dbb7ea6">BLE_GAP_ADV_FP_ANY</a>;
<a name="l00264"></a>00264     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a6c52a3d605c056768b59164ce8df8334">interval</a>    = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga6b8aee23a937868a6bbb2feeb08fd92e">NON_CONNECTABLE_ADV_INTERVAL</a>;
<a name="l00265"></a>00265     s_adv_params.<a class="code" href="structble__gap__adv__params__t.html#a7f1ad43d3bf79b40bc39dbb5a6c3a5ae">timeout</a>     = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga560763b9fb39a5ff10a86255b583acc0">APP_CFG_NON_CONN_ADV_TIMEOUT</a>;
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267 
<a name="l00268"></a>00268 
<a name="l00275"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gae64bf38f2019810fa55bd7ceaa0d39e9">00275</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gae64bf38f2019810fa55bd7ceaa0d39e9" title="Advertisement paccket init function.">advertising_data_init</a>(<span class="keywordtype">void</span>)
<a name="l00276"></a>00276 {
<a name="l00277"></a>00277     uint32_t                   err_code;
<a name="l00278"></a>00278     <a class="code" href="structble__advdata__t.html" title="Advertising data structure. This contains all options and data needed for encoding and setting the ad...">ble_advdata_t</a>              advdata;
<a name="l00279"></a>00279     <a class="code" href="structble__advdata__manuf__data__t.html" title="Manufacturer specific data structure.">ble_advdata_manuf_data_t</a>   manuf_data;
<a name="l00280"></a>00280     uint8_t                    flags = <a class="code" href="group___b_l_e___g_a_p___d_i_s_c___m_o_d_e_s.html#ga5c5243da93bae524088eefd608656012">BLE_GAP_DISC_MODE_LIMITED</a> |
<a name="l00281"></a>00281                                        <a class="code" href="group___b_l_e___g_a_p___d_i_s_c___m_o_d_e_s.html#ga346a5b47f4b8f94a08f320a0d8c14c18">BLE_GAP_DISC_BR_EDR_NOT_SUPPORTED</a>;
<a name="l00282"></a>00282 
<a name="l00283"></a>00283     <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">sizeof</span>(flags) == <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga1f05d89a33b1cf6b00e5fd613f9bbd09">ADV_FLAGS_LEN</a>)  <span class="comment">// Assert that these two values of the same.</span>
<a name="l00284"></a>00284 
<a name="l00285"></a>00285     <span class="comment">// Build and set advertising data</span>
<a name="l00286"></a>00286     memset(&amp;advdata, 0, <span class="keyword">sizeof</span>(advdata));
<a name="l00287"></a>00287 
<a name="l00288"></a>00288     manuf_data.<a class="code" href="structble__advdata__manuf__data__t.html#a183f3142ec5095963ab0ddb58d90a49c">company_identifier</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga4385d0276b988006b19c1fe08161fb7f">COMPANY_IDENTIFIER</a>;
<a name="l00289"></a>00289     manuf_data.<a class="code" href="structble__advdata__manuf__data__t.html#a52ebf147190879b03b057d7b80ec185d">data</a>.<a class="code" href="structuint8__array__t.html#aaba88b24a21a6c70c895c0d55f4a69a0">size</a>          = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga79b025307017e3fc5661e38ee76b04fb">ADV_MANUF_DATA_LEN</a>;
<a name="l00290"></a>00290     manuf_data.<a class="code" href="structble__advdata__manuf__data__t.html#a52ebf147190879b03b057d7b80ec185d">data</a>.<a class="code" href="structuint8__array__t.html#a8304c4af5da6e830b86d7199dc9a22e6">p_data</a>        = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf2c1a985510302fbec992f686c392e3d">s_adv_manuf_data</a>;
<a name="l00291"></a>00291     advdata.<a class="code" href="structble__advdata__t.html#a3ad6b2c5a983e0f2676c85c546ed47ae">flags</a>.<a class="code" href="structuint8__array__t.html#aaba88b24a21a6c70c895c0d55f4a69a0">size</a>            = <span class="keyword">sizeof</span>(flags);
<a name="l00292"></a>00292     advdata.<a class="code" href="structble__advdata__t.html#a3ad6b2c5a983e0f2676c85c546ed47ae">flags</a>.<a class="code" href="structuint8__array__t.html#a8304c4af5da6e830b86d7199dc9a22e6">p_data</a>          = &amp;flags;
<a name="l00293"></a>00293     advdata.<a class="code" href="structble__advdata__t.html#ac190b7d26572836c7a381ef0ad0343aa">p_manuf_specific_data</a> = &amp;manuf_data;
<a name="l00294"></a>00294 
<a name="l00295"></a>00295     err_code = <a class="code" href="group__ble__sdk__lib__advdata.html#ga180ff4057a0763688c734e98ab8d976b" title="Encodes and sets the advertising data and/or scan response data.">ble_advdata_set</a>(&amp;advdata, NULL);
<a name="l00296"></a>00296     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00297"></a>00297     {
<a name="l00298"></a>00298         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00299"></a>00299     }
<a name="l00300"></a>00300 }
<a name="l00301"></a>00301 
<a name="l00302"></a>00302 
<a name="l00308"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaefcf3206bdbe52a9eb2e07f58354b783">00308</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaefcf3206bdbe52a9eb2e07f58354b783" title="Characteristic add function.">char_add</a>(<span class="keywordtype">void</span>)
<a name="l00309"></a>00309 {
<a name="l00310"></a>00310     uint32_t            err_code;
<a name="l00311"></a>00311     <a class="code" href="structble__gatts__char__md__t.html" title="GATT Characteristic Medatadata.">ble_gatts_char_md_t</a> char_md;
<a name="l00312"></a>00312     <a class="code" href="structble__gatts__attr__md__t.html" title="Attribute metadata.">ble_gatts_attr_md_t</a> cccd_md;
<a name="l00313"></a>00313     <a class="code" href="structble__gatts__attr__t.html" title="GATT Attribute.">ble_gatts_attr_t</a>    attr_char_value;
<a name="l00314"></a>00314     <a class="code" href="structble__uuid__t.html" title="Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs.">ble_uuid_t</a>          char_uuid;
<a name="l00315"></a>00315     <a class="code" href="structble__gatts__attr__md__t.html" title="Attribute metadata.">ble_gatts_attr_md_t</a> attr_md;
<a name="l00316"></a>00316 
<a name="l00317"></a>00317     memset(&amp;cccd_md, 0, <span class="keyword">sizeof</span>(cccd_md));
<a name="l00318"></a>00318 
<a name="l00319"></a>00319     <a class="code" href="group___b_l_e___g_a_p___c_o_n_n___s_e_c___m_o_d_e___s_e_t___m_a_c_r_o_s.html#ga2abd1c711d49a4d4b1ab9bf27cafffbb" title="Set sec_mode pointed to by ptr to require no protection, open link.">BLE_GAP_CONN_SEC_MODE_SET_OPEN</a>(&amp;cccd_md.<a class="code" href="structble__gatts__attr__md__t.html#af0352a482ca2a1305ec5941bc4af0ec2">read_perm</a>);
<a name="l00320"></a>00320     <a class="code" href="group___b_l_e___g_a_p___c_o_n_n___s_e_c___m_o_d_e___s_e_t___m_a_c_r_o_s.html#ga2abd1c711d49a4d4b1ab9bf27cafffbb" title="Set sec_mode pointed to by ptr to require no protection, open link.">BLE_GAP_CONN_SEC_MODE_SET_OPEN</a>(&amp;cccd_md.<a class="code" href="structble__gatts__attr__md__t.html#a6060006e42afe1970aed0a8490f71445">write_perm</a>);
<a name="l00321"></a>00321 
<a name="l00322"></a>00322     memset(&amp;char_md, 0, <span class="keyword">sizeof</span>(char_md));
<a name="l00323"></a>00323 
<a name="l00324"></a>00324     char_md.<a class="code" href="structble__gatts__char__md__t.html#a5d81476b727bf4053879046f72049b48">char_properties</a>.<a class="code" href="structble__gatts__char__properties__t.html#ad99a3f990d972bf0b87f25fd507eb599">read</a>   = 1;
<a name="l00325"></a>00325     char_md.<a class="code" href="structble__gatts__char__md__t.html#a5d81476b727bf4053879046f72049b48">char_properties</a>.<a class="code" href="structble__gatts__char__properties__t.html#ab4ddab4f7ba8461e378ffa590bb15dd8">notify</a> = 1;
<a name="l00326"></a>00326     char_md.<a class="code" href="structble__gatts__char__md__t.html#a48ddd998bdda2b2b93e305ba46137d41">p_char_user_desc</a>       = NULL;
<a name="l00327"></a>00327     char_md.<a class="code" href="structble__gatts__char__md__t.html#ad1fe5fdc8f07028e11054f2288c7fc14">p_char_pf</a>              = NULL;
<a name="l00328"></a>00328     char_md.<a class="code" href="structble__gatts__char__md__t.html#a2bce0c863bf96476ad1629c676042d34">p_user_desc_md</a>         = NULL;
<a name="l00329"></a>00329     char_md.<a class="code" href="structble__gatts__char__md__t.html#a5d654340f27d7c8f113a45beebb50312">p_cccd_md</a>              = &amp;cccd_md;
<a name="l00330"></a>00330     char_md.<a class="code" href="structble__gatts__char__md__t.html#a642bc361c2131bdf054da18ce4e9a3e7">p_sccd_md</a>              = NULL;
<a name="l00331"></a>00331 
<a name="l00332"></a>00332     char_uuid.<a class="code" href="structble__uuid__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a> = <a class="code" href="group___b_l_e___u_u_i_d___t_y_p_e_s.html#ga7bdcaea9ea91ab20be755d78833da46d">BLE_UUID_TYPE_VENDOR_BEGIN</a> + <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaec7f925a06b06de7081202c846b6d536">LOCAL_VENDOR_UUID_INDEX</a>;  <span class="comment">// Position of the Vender specific ID base in s_base_uuid128s.</span>
<a name="l00333"></a>00333     char_uuid.<a class="code" href="structble__uuid__t.html#aaa1ded1f77a9c12a196ed4ba2ce5f95d">uuid</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf93b1cc507e504d92a6708d8aa959a31">LOCAL_CHAR_UUID</a>;
<a name="l00334"></a>00334 
<a name="l00335"></a>00335     memset(&amp;attr_md, 0, <span class="keyword">sizeof</span>(attr_md));
<a name="l00336"></a>00336 
<a name="l00337"></a>00337     <a class="code" href="group___b_l_e___g_a_p___c_o_n_n___s_e_c___m_o_d_e___s_e_t___m_a_c_r_o_s.html#ga2abd1c711d49a4d4b1ab9bf27cafffbb" title="Set sec_mode pointed to by ptr to require no protection, open link.">BLE_GAP_CONN_SEC_MODE_SET_OPEN</a>(&amp;attr_md.<a class="code" href="structble__gatts__attr__md__t.html#af0352a482ca2a1305ec5941bc4af0ec2">read_perm</a>);
<a name="l00338"></a>00338     <a class="code" href="group___b_l_e___g_a_p___c_o_n_n___s_e_c___m_o_d_e___s_e_t___m_a_c_r_o_s.html#ga1cf3822f8bb11e28931afbb9179665b7" title="Set sec_mode pointed to by ptr to have no access rights.">BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS</a>(&amp;attr_md.<a class="code" href="structble__gatts__attr__md__t.html#a6060006e42afe1970aed0a8490f71445">write_perm</a>);
<a name="l00339"></a>00339 
<a name="l00340"></a>00340     attr_md.<a class="code" href="structble__gatts__attr__md__t.html#ac68fa2d9eb5f49771a80414d2c6bb690">rd_defer</a> = 0;
<a name="l00341"></a>00341     attr_md.<a class="code" href="structble__gatts__attr__md__t.html#ad44d77b2d08d2dde61c9ccbb22fa7432">wr_defer</a> = 0;
<a name="l00342"></a>00342     attr_md.<a class="code" href="structble__gatts__attr__md__t.html#a248864ad6fe6949aa81d376cdd7d07b4">vlen</a>     = 0;
<a name="l00343"></a>00343 
<a name="l00344"></a>00344     memset(&amp;attr_char_value, 0, <span class="keyword">sizeof</span>(attr_char_value));
<a name="l00345"></a>00345 
<a name="l00346"></a>00346     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#a8af1eafb75d1d1e9c4cacf188fad299e">p_uuid</a>       = &amp;char_uuid;
<a name="l00347"></a>00347     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#a573caddb6f66206646fcf38fa7c1a211">p_attr_md</a>    = &amp;attr_md;
<a name="l00348"></a>00348     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#a9e68f6d248f0c128406979df16f88255">init_len</a>     = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">APP_CFG_CHAR_LEN</a>;
<a name="l00349"></a>00349     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#a44cd93c5a44c06d426920c36a3971eb1">init_offs</a>    = 0;
<a name="l00350"></a>00350     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#a1a6c02276292f164788906e8d5a316e5">max_len</a>      = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga25c08352c9bdbc5c273f2260753306ce">APP_CFG_CHAR_LEN</a>;
<a name="l00351"></a>00351     attr_char_value.<a class="code" href="structble__gatts__attr__t.html#ac439d398694461e592c0af528994705e">p_init_value</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gabda72b268ff799e0669dc35bd53061e7">s_char_value</a>;
<a name="l00352"></a>00352 
<a name="l00353"></a>00353     err_code = <a class="code" href="group___b_l_e___g_a_t_t_s.html#gae4a1d9149f4531d66d06bf289886106d" title="Add a characteristic declaration, a characteristic value declaration and optional characteristic desc...">ble_gatts_characteristic_add</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga90ec27d28a69ce12e4dfac8889b64e30">s_service_handle</a>,
<a name="l00354"></a>00354                                             &amp;char_md,
<a name="l00355"></a>00355                                             &amp;attr_char_value,
<a name="l00356"></a>00356                                             &amp;s_char_handles);
<a name="l00357"></a>00357     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00358"></a>00358     {
<a name="l00359"></a>00359         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00360"></a>00360     }
<a name="l00361"></a>00361 }
<a name="l00362"></a>00362 
<a name="l00363"></a>00363 
<a name="l00369"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad49f9175444b3807f1656765165799a5">00369</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad49f9175444b3807f1656765165799a5" title="Service add function.">service_add</a>(<span class="keywordtype">void</span>)
<a name="l00370"></a>00370 {
<a name="l00371"></a>00371     <a class="code" href="structble__uuid__t.html" title="Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs.">ble_uuid_t</a>  service_uuid;
<a name="l00372"></a>00372     uint32_t    err_code;
<a name="l00373"></a>00373 
<a name="l00374"></a>00374     err_code = <a class="code" href="group__ble__api.html#ga6266a237491ab1aab2b0c2d8881ad775" title="Assign Vendor Specific UUIDs.">ble_vs_uuids_assign</a>(1, <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gab2bc7dc71fbbcac4685881915c9ca91e" title="128-bit UUID base List.">s_base_uuid128s</a>);
<a name="l00375"></a>00375     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00376"></a>00376     {
<a name="l00377"></a>00377         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00378"></a>00378     }
<a name="l00379"></a>00379     
<a name="l00380"></a>00380     service_uuid.<a class="code" href="structble__uuid__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a> = <a class="code" href="group___b_l_e___u_u_i_d___t_y_p_e_s.html#ga7bdcaea9ea91ab20be755d78833da46d">BLE_UUID_TYPE_VENDOR_BEGIN</a> + <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaec7f925a06b06de7081202c846b6d536">LOCAL_VENDOR_UUID_INDEX</a>;  <span class="comment">// Position of the Vender specific ID base in s_base_uuid128s.</span>
<a name="l00381"></a>00381     service_uuid.<a class="code" href="structble__uuid__t.html#aaa1ded1f77a9c12a196ed4ba2ce5f95d">uuid</a> = <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga44a2aaf4d9ce96f1b25a577e09015ebc">LOCAL_SERVICE_UUID</a>;
<a name="l00382"></a>00382 
<a name="l00383"></a>00383     err_code = <a class="code" href="group___b_l_e___g_a_t_t_s.html#ga5e8270fe6dfa01e446be17b48fe81e2a" title="Add a service declaration to the local server database.">ble_gatts_service_add</a>(<a class="code" href="group___b_l_e___g_a_t_t_s___s_v_c___t_y_p_e_s.html#ga713ed30865fa70c89587ba981f114a91">BLE_GATTS_SVC_TYPE_PRIMARY</a>, &amp;service_uuid, &amp;<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga90ec27d28a69ce12e4dfac8889b64e30">s_service_handle</a>);
<a name="l00384"></a>00384     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00385"></a>00385     {
<a name="l00386"></a>00386         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00387"></a>00387     }
<a name="l00388"></a>00388 
<a name="l00389"></a>00389     <span class="comment">// Add characteristics</span>
<a name="l00390"></a>00390     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaefcf3206bdbe52a9eb2e07f58354b783" title="Characteristic add function.">char_add</a>();
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392 
<a name="l00393"></a>00393 
<a name="l00399"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga121d089b824f9cd14b339f8fb0fae7b3">00399</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga121d089b824f9cd14b339f8fb0fae7b3" title="Notification timeout handler.">notif_timeout_handler</a>(app_timer_id_t timer_id)
<a name="l00400"></a>00400 {
<a name="l00401"></a>00401     uint32_t err_code;
<a name="l00402"></a>00402     
<a name="l00403"></a>00403     <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(timer_id == APP_TIMER_CHAR_NOTIFICATION);
<a name="l00404"></a>00404 
<a name="l00405"></a>00405     <span class="comment">// Stop all notifications (by stopping the timer for connection interval that triggers </span>
<a name="l00406"></a>00406     <span class="comment">// notifications and disconnecting from peer)</span>
<a name="l00407"></a>00407     <a class="code" href="group__app__timer.html#ga4112ddbc75deb5c4d5db7c8afb1f5d8a" title="Stops the specified timer.">app_timer_stop</a>(APP_TIMER_CONN_INTERVAL); 
<a name="l00408"></a>00408     err_code = <a class="code" href="group___b_l_e___g_a_p.html#ga1b72b0bedcc2ff560582527aee8e6416" title="Disconnect (GAP Link Termination).">ble_gap_disconnect</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a>, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
<a name="l00409"></a>00409     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00410"></a>00410     {
<a name="l00411"></a>00411         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00412"></a>00412     }
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415 
<a name="l00423"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga38c78315f8d51b2ee6449ede5be4624c">00423</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga38c78315f8d51b2ee6449ede5be4624c" title="Connection interval timeout handler.">connection_interval_timeout_handler</a>(app_timer_id_t timer_id)
<a name="l00424"></a>00424 {
<a name="l00425"></a>00425     <span class="comment">// Into next connection interval. Send one notification.</span>
<a name="l00426"></a>00426     <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(timer_id == APP_TIMER_CONN_INTERVAL);
<a name="l00427"></a>00427     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga76045b247174748cfb7bbd3db14171cd" title="Characteristic notification function.">char_notify</a>();
<a name="l00428"></a>00428 }
<a name="l00429"></a>00429 
<a name="l00430"></a>00430 
<a name="l00437"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga59f2752bdf059ab72ec3987d0b1db770">00437</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga59f2752bdf059ab72ec3987d0b1db770" title="Start application timers.">application_timers_start</a>(<span class="keywordtype">void</span>)
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439     uint32_t err_code;
<a name="l00440"></a>00440 
<a name="l00441"></a>00441     <span class="comment">// Start connection interval timer.     </span>
<a name="l00442"></a>00442     err_code = <a class="code" href="group__app__timer.html#ga54651d3dc5266bd7541b80918527b060" title="Starts a timer.">app_timer_start</a>(APP_TIMER_CONN_INTERVAL,
<a name="l00443"></a>00443                                <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga38c78315f8d51b2ee6449ede5be4624c" title="Connection interval timeout handler.">connection_interval_timeout_handler</a>,
<a name="l00444"></a>00444                                <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga010a0abfa2f84b5290d55c0a3f3757f0">APP_CFG_CONNECTION_INTERVAL</a>,
<a name="l00445"></a>00445                                APP_TIMER_MODE_REPEATED,
<a name="l00446"></a>00446                                <a class="code" href="group__app__timer.html#ga02ba0b12340bf53b472283b752257f06">APP_TIMER_LOWEST_PRI</a>);
<a name="l00447"></a>00447     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00448"></a>00448     {
<a name="l00449"></a>00449         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00450"></a>00450     }
<a name="l00451"></a>00451 
<a name="l00452"></a>00452     <span class="comment">// Start characteristic notification timer.</span>
<a name="l00453"></a>00453     err_code = <a class="code" href="group__app__timer.html#ga54651d3dc5266bd7541b80918527b060" title="Starts a timer.">app_timer_start</a>(APP_TIMER_CHAR_NOTIFICATION,
<a name="l00454"></a>00454                                <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga121d089b824f9cd14b339f8fb0fae7b3" title="Notification timeout handler.">notif_timeout_handler</a>,
<a name="l00455"></a>00455                                <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga21391c876b70819800ee07cabb337448">APP_CFG_CHAR_NOTIF_TIMEOUT</a>,
<a name="l00456"></a>00456                                APP_TIMER_MODE_SINGLE_SHOT,
<a name="l00457"></a>00457                                <a class="code" href="group__app__timer.html#ga02ba0b12340bf53b472283b752257f06">APP_TIMER_LOWEST_PRI</a>);
<a name="l00458"></a>00458     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00459"></a>00459     {
<a name="l00460"></a>00460         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00461"></a>00461     }
<a name="l00462"></a>00462 }
<a name="l00463"></a>00463 
<a name="l00464"></a>00464 
<a name="l00467"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8816338f0269bbffa4cf5c2ec105eee9">00467</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8816338f0269bbffa4cf5c2ec105eee9" title="Stop application timers.">application_timers_stop</a>(<span class="keywordtype">void</span>)
<a name="l00468"></a>00468 {
<a name="l00469"></a>00469     <a class="code" href="group__app__timer.html#ga4112ddbc75deb5c4d5db7c8afb1f5d8a" title="Stops the specified timer.">app_timer_stop</a>(APP_TIMER_CHAR_NOTIFICATION);
<a name="l00470"></a>00470     <a class="code" href="group__app__timer.html#ga4112ddbc75deb5c4d5db7c8afb1f5d8a" title="Stops the specified timer.">app_timer_stop</a>(APP_TIMER_CONN_INTERVAL);
<a name="l00471"></a>00471 }
<a name="l00472"></a>00472 
<a name="l00473"></a>00473 
<a name="l00476"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gadf80cd84ee702e57a2a416fe4f653eb8">00476</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gadf80cd84ee702e57a2a416fe4f653eb8" title="Start advertising.">advertising_start</a>(<span class="keywordtype">void</span>)
<a name="l00477"></a>00477 {
<a name="l00478"></a>00478     uint32_t err_code;
<a name="l00479"></a>00479     
<a name="l00480"></a>00480     err_code = <a class="code" href="group___b_l_e___g_a_p.html#gabdbf78c3a8b09c6f2fb92d8733096af8" title="Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure).">ble_gap_adv_start</a>(&amp;s_adv_params);
<a name="l00481"></a>00481     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00482"></a>00482     {
<a name="l00483"></a>00483         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00484"></a>00484     }
<a name="l00485"></a>00485 }
<a name="l00486"></a>00486 
<a name="l00487"></a>00487 
<a name="l00492"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga09658aaa0774820d8f25249d551bc283">00492</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga09658aaa0774820d8f25249d551bc283" title="Timer initialization.">timers_init</a>(<span class="keywordtype">void</span>)
<a name="l00493"></a>00493 {
<a name="l00494"></a>00494     uint32_t err_code;
<a name="l00495"></a>00495 
<a name="l00496"></a>00496     <span class="comment">// Initialize timer module</span>
<a name="l00497"></a>00497     err_code = <a class="code" href="group__app__timer.html#ga4e1da5a2f64ee78ee97f7422ea97e439" title="Initializes the timer module.">app_timer_init</a>(NULL);
<a name="l00498"></a>00498     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00499"></a>00499     {
<a name="l00500"></a>00500         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00501"></a>00501     }
<a name="l00502"></a>00502 }
<a name="l00503"></a>00503 
<a name="l00504"></a>00504 
<a name="l00513"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga70525a816fec301fa4c9d564831c440b">00513</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga70525a816fec301fa4c9d564831c440b" title="Funtion that evaluates the value written in CCCD.">on_write</a>(<a class="code" href="structble__evt__t.html" title="Common BLE Event type, wrapping the module specific event reports.">ble_evt_t</a> * p_ble_evt)
<a name="l00514"></a>00514 {
<a name="l00515"></a>00515     <a class="code" href="structble__gatts__evt__write__t.html" title="Event structure for BLE_GATTS_EVT_WRITE.">ble_gatts_evt_write_t</a> * p_evt_write = &amp;p_ble_evt-&gt;evt.<a class="code" href="structble__evt__t.html#a91857ca158f0c4e43f610068772c7d3d">gatts_evt</a>.params.<a class="code" href="structble__gatts__evt__t.html#a682c515271ef8a1b93b7643a1023e8b8">write</a>;
<a name="l00516"></a>00516 
<a name="l00517"></a>00517     <span class="keywordflow">if</span> (
<a name="l00518"></a>00518        (p_evt_write-&gt;<a class="code" href="structble__gatts__evt__write__t.html#af242d6e3b6108ea75e1eb236e94c8240">handle</a> == s_char_handles.<a class="code" href="structble__gatts__char__handles__t.html#a2c7796d4eb58c25a1a724bcd9d5bf183">cccd_handle</a>)
<a name="l00519"></a>00519        &amp;&amp;
<a name="l00520"></a>00520        (p_evt_write-&gt;<a class="code" href="structble__gatts__evt__write__t.html#a8aed22e2c7b283705ec82e0120515618">len</a> == 2)
<a name="l00521"></a>00521     )
<a name="l00522"></a>00522     {
<a name="l00523"></a>00523         <span class="comment">// CCCD written. Start notifications</span>
<a name="l00524"></a>00524         <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf1f61dda3c80fe8ee2ffdcbf6d8c902c">s_is_notifying_enabled</a> = <a class="code" href="group__ble__sdk__srv__common.html#ga11fd3cc1b15d4bec4accc37618305ccb" title="Inline function for decoding a CCCD value, and then testing if notification is enabled.">ble_srv_is_notification_enabled</a>(p_evt_write-&gt;<a class="code" href="structble__gatts__evt__write__t.html#aa86e1085c6a16f60258f29c9d5fc2144">data</a>);
<a name="l00525"></a>00525 
<a name="l00526"></a>00526         <span class="keywordflow">if</span> (<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaf1f61dda3c80fe8ee2ffdcbf6d8c902c">s_is_notifying_enabled</a>)
<a name="l00527"></a>00527         {
<a name="l00528"></a>00528             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga59f2752bdf059ab72ec3987d0b1db770" title="Start application timers.">application_timers_start</a>();
<a name="l00529"></a>00529             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga76045b247174748cfb7bbd3db14171cd" title="Characteristic notification function.">char_notify</a>();
<a name="l00530"></a>00530         }
<a name="l00531"></a>00531         <span class="keywordflow">else</span>
<a name="l00532"></a>00532         {
<a name="l00533"></a>00533             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8816338f0269bbffa4cf5c2ec105eee9" title="Stop application timers.">application_timers_stop</a>();
<a name="l00534"></a>00534         }
<a name="l00535"></a>00535     }
<a name="l00536"></a>00536 }
<a name="l00537"></a>00537 
<a name="l00538"></a>00538 
<a name="l00543"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad083cb3569230d7ecbf2d01ef2a2c1d9">00543</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad083cb3569230d7ecbf2d01ef2a2c1d9" title="Application&#39;s BLE Stack event handler.">on_ble_evt</a>(<a class="code" href="structble__evt__t.html" title="Common BLE Event type, wrapping the module specific event reports.">ble_evt_t</a> * p_ble_evt)
<a name="l00544"></a>00544 {
<a name="l00545"></a>00545     uint32_t err_code = <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>;
<a name="l00546"></a>00546     
<a name="l00547"></a>00547     <span class="keywordflow">switch</span> (p_ble_evt-&gt;<a class="code" href="structble__evt__t.html#a50f33abba5627a26728ba30fffd9880a">header</a>.<a class="code" href="structble__evt__hdr__t.html#a826314e7ea25d4267621899efe6859f9">evt_id</a>)
<a name="l00548"></a>00548     {
<a name="l00549"></a>00549         <span class="keywordflow">case</span> <a class="code" href="group___b_l_e___g_a_p.html#ggabc5c98fcc1211af2b80116dd6e0a035daa0b4789724d202a13a5e7eab85c52957">BLE_GAP_EVT_CONNECTED</a>:
<a name="l00550"></a>00550             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a> = p_ble_evt-&gt;evt.<a class="code" href="structble__evt__t.html#a91857ca158f0c4e43f610068772c7d3d">gatts_evt</a>.<a class="code" href="structble__gatts__evt__t.html#a0d5ffe38d68e48d81e61fc6a4999ae68">conn_handle</a>;
<a name="l00551"></a>00551             <span class="keywordflow">break</span>;
<a name="l00552"></a>00552             
<a name="l00553"></a>00553         <span class="keywordflow">case</span> <a class="code" href="group___b_l_e___g_a_p.html#ggabc5c98fcc1211af2b80116dd6e0a035da057001bbd6ea9e615f19ef93cc0831ee">BLE_GAP_EVT_DISCONNECTED</a>:
<a name="l00554"></a>00554             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a> = <a class="code" href="group___b_l_e___c_o_n_n___h_a_n_d_l_e_s.html#gacf227b9b101dbcf08eccbbaba54e48f5">BLE_CONN_HANDLE_INVALID</a>;
<a name="l00555"></a>00555             
<a name="l00556"></a>00556             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8816338f0269bbffa4cf5c2ec105eee9" title="Stop application timers.">application_timers_stop</a>();
<a name="l00557"></a>00557             
<a name="l00558"></a>00558             <span class="comment">// Go to system-off mode            </span>
<a name="l00559"></a>00559             err_code = <a class="code" href="group__nrf__soc__api.html#ga302701614c7bb1c9fc01dafec2bb04fb" title="Puts the chip in System OFF mode.">nrf_power_system_off</a>();
<a name="l00560"></a>00560             <span class="keywordflow">break</span>;
<a name="l00561"></a>00561 
<a name="l00562"></a>00562         <span class="keywordflow">case</span> <a class="code" href="group___b_l_e___g_a_t_t_s.html#gga80155586fa275b28773c9b203f52cabaae3776204f11a583e105aed0e477601da">BLE_GATTS_EVT_SYS_ATTR_MISSING</a>:
<a name="l00563"></a>00563             err_code = <a class="code" href="group___b_l_e___g_a_t_t_s.html#ga65ae169e49530eb2fa4bf73053060a13" title="Update persistent system attribute info.">ble_gatts_sys_attr_set</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaf76d22968f9f320aa5005a25f654320">s_conn_handle</a>, NULL, 0);
<a name="l00564"></a>00564             <span class="keywordflow">break</span>;
<a name="l00565"></a>00565 
<a name="l00566"></a>00566         <span class="keywordflow">case</span> <a class="code" href="group___b_l_e___g_a_p.html#ggabc5c98fcc1211af2b80116dd6e0a035da57e5d1061d9b3d1500fb3556a3fb8847">BLE_GAP_EVT_TIMEOUT</a>:
<a name="l00567"></a>00567             <span class="keywordflow">if</span> (p_ble_evt-&gt;evt.<a class="code" href="structble__evt__t.html#a2fd98f8868b9aea30d35bf71d41d646a">gap_evt</a>.params.<a class="code" href="structble__gap__evt__t.html#a17e289da592e731cde1451c2d5f3f24a">timeout</a>.<a class="code" href="structble__gap__evt__timeout__t.html#af5eca485cd2b34522478907d4c8f5bc6">src</a> == <a class="code" href="group___b_l_e___g_a_p___t_i_m_e_o_u_t___t_y_p_e_s.html#gafee7b7095fb21ed922c6719cc1c2d23f">BLE_GAP_TIMEOUT_TYPE_ADVERTISEMENT</a>)
<a name="l00568"></a>00568             { 
<a name="l00569"></a>00569                 <span class="comment">// Go to system-off mode (this function will not return; wakeup will cause a reset)</span>
<a name="l00570"></a>00570                 err_code = <a class="code" href="group__nrf__soc__api.html#ga302701614c7bb1c9fc01dafec2bb04fb" title="Puts the chip in System OFF mode.">nrf_power_system_off</a>(); 
<a name="l00571"></a>00571             }
<a name="l00572"></a>00572             <span class="keywordflow">break</span>;
<a name="l00573"></a>00573             
<a name="l00574"></a>00574         <span class="keywordflow">case</span> <a class="code" href="group___b_l_e___g_a_t_t_s.html#gga80155586fa275b28773c9b203f52cabaaa68b7764f5264ff092d2ad17851355ed">BLE_GATTS_EVT_WRITE</a>:
<a name="l00575"></a>00575             <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga70525a816fec301fa4c9d564831c440b" title="Funtion that evaluates the value written in CCCD.">on_write</a>(p_ble_evt);
<a name="l00576"></a>00576             <span class="keywordflow">break</span>;
<a name="l00577"></a>00577 
<a name="l00578"></a>00578         <span class="keywordflow">default</span>:
<a name="l00579"></a>00579             <span class="keywordflow">break</span>;
<a name="l00580"></a>00580     }
<a name="l00581"></a>00581     
<a name="l00582"></a>00582     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00583"></a>00583     {
<a name="l00584"></a>00584         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00585"></a>00585     }
<a name="l00586"></a>00586 }
<a name="l00587"></a>00587 
<a name="l00588"></a>00588 
<a name="l00596"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga2b08d6ccb6e7f4588d2ac843d4494c0e">00596</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga2b08d6ccb6e7f4588d2ac843d4494c0e" title="Dispatches a BLE stack event to all modules with a BLE stack event handler.">ble_evt_dispatch</a>(<a class="code" href="structble__evt__t.html" title="Common BLE Event type, wrapping the module specific event reports.">ble_evt_t</a> * p_ble_evt)
<a name="l00597"></a>00597 {
<a name="l00598"></a>00598     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad083cb3569230d7ecbf2d01ef2a2c1d9" title="Application&#39;s BLE Stack event handler.">on_ble_evt</a>(p_ble_evt);
<a name="l00599"></a>00599 }
<a name="l00600"></a>00600 
<a name="l00601"></a>00601 
<a name="l00606"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaa06a7a39e83ec4cf3553f4ed6ba6323a">00606</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaa06a7a39e83ec4cf3553f4ed6ba6323a" title="BLE stack initialization.">ble_stack_init</a>(<span class="keywordtype">void</span>)
<a name="l00607"></a>00607 {
<a name="l00608"></a>00608     uint32_t err_code = <a class="code" href="group__ble__stack__handler.html#gada9282a45a226bbe8544995b2fbf22dd" title="Initialize stack handler module.">ble_stack_handler_init</a>(<a class="code" href="group__nrf__sdm__api.html#ggaaf8fd5f0e57d456151c951e0f3715fc4a1c5e9917211a50eac336a3fd2e467756">NRF_CLOCK_LFCLKSRC_XTAL_20_PPM</a>, <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga2b08d6ccb6e7f4588d2ac843d4494c0e" title="Dispatches a BLE stack event to all modules with a BLE stack event handler.">ble_evt_dispatch</a>);
<a name="l00609"></a>00609     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00610"></a>00610     {
<a name="l00611"></a>00611         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00612"></a>00612     }
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614 
<a name="l00615"></a>00615 
<a name="l00618"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga265c25c068555fbfae4ab4f391060040">00618</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__gzll__ui.html#gacef6dd444cb6560da652897ee43ab306" title="Initialize GPIOTE module for detecting buttons.">buttons_init</a>(<span class="keywordtype">void</span>)
<a name="l00619"></a>00619 {
<a name="l00620"></a>00620     NRF_GPIO-&gt;PIN_CNF[<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaed671c6b234821122d1d5001f3c7070">NOTIF_BUTTON_PIN_NO</a>] =
<a name="l00621"></a>00621                                           (GPIO_PIN_CNF_DIR_Input     &lt;&lt; GPIO_PIN_CNF_DIR_Pos)    |
<a name="l00622"></a>00622                                           (GPIO_PIN_CNF_INPUT_Connect &lt;&lt; GPIO_PIN_CNF_INPUT_Pos)  |
<a name="l00623"></a>00623                                           (GPIO_PIN_CNF_PULL_Disabled &lt;&lt; GPIO_PIN_CNF_PULL_Pos)   |
<a name="l00624"></a>00624                                           (GPIO_PIN_CNF_DRIVE_S0S1    &lt;&lt; GPIO_PIN_CNF_DRIVE_Pos)  |
<a name="l00625"></a>00625                                           (GPIO_PIN_CNF_SENSE_Low     &lt;&lt; GPIO_PIN_CNF_SENSE_Pos);
<a name="l00626"></a>00626 
<a name="l00627"></a>00627     NRF_GPIO-&gt;PIN_CNF[<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga0ba1e5fcb6523111994123a3149aeabb">NON_CONN_ADV_BUTTON_PIN_NO</a>] =
<a name="l00628"></a>00628                                           (GPIO_PIN_CNF_DIR_Input     &lt;&lt; GPIO_PIN_CNF_DIR_Pos)    |
<a name="l00629"></a>00629                                           (GPIO_PIN_CNF_INPUT_Connect &lt;&lt; GPIO_PIN_CNF_INPUT_Pos)  |
<a name="l00630"></a>00630                                           (GPIO_PIN_CNF_PULL_Disabled &lt;&lt; GPIO_PIN_CNF_PULL_Pos)   |
<a name="l00631"></a>00631                                           (GPIO_PIN_CNF_DRIVE_S0S1    &lt;&lt; GPIO_PIN_CNF_DRIVE_Pos)  |
<a name="l00632"></a>00632                                           (GPIO_PIN_CNF_SENSE_Low     &lt;&lt; GPIO_PIN_CNF_SENSE_Pos); 
<a name="l00633"></a>00633 }
<a name="l00634"></a>00634 
<a name="l00635"></a>00635 
<a name="l00644"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8014b2b4745214caa69c5fddd0401388">00644</a> <span class="keyword">static</span> __INLINE uint32_t <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8014b2b4745214caa69c5fddd0401388" title="Read the state of the input pin.">gpio_pin_read</a>(uint32_t pin_number)
<a name="l00645"></a>00645 {
<a name="l00646"></a>00646     <span class="keywordflow">return</span>  ((NRF_GPIO-&gt;IN &gt;&gt; pin_number) &amp; 1UL);  
<a name="l00647"></a>00647 }
<a name="l00648"></a>00648 
<a name="l00649"></a>00649 
<a name="l00652"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga3adda2642702fdb99b08992c39494000">00652</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga3adda2642702fdb99b08992c39494000" title="Power manager.">power_manage</a>(<span class="keywordtype">void</span>)
<a name="l00653"></a>00653 {
<a name="l00654"></a>00654     uint32_t err_code = <a class="code" href="group__nrf__soc__api.html#ga2aae5f388f1b6179058c62e2fb05a547" title="Waits for an application event.">nrf_wait_for_app_event</a>();
<a name="l00655"></a>00655     <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00656"></a>00656     {
<a name="l00657"></a>00657         <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00658"></a>00658     }
<a name="l00659"></a>00659 }
<a name="l00660"></a>00660 
<a name="l00661"></a>00661 
<a name="l00664"></a><a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga840291bc02cba5474a4cb46a9b9566fe">00664</a> <span class="keywordtype">int</span> <a class="code" href="group__ble__sdk__app__gzll__main.html#ga840291bc02cba5474a4cb46a9b9566fe" title="Application main function.">main</a>(<span class="keywordtype">void</span>)
<a name="l00665"></a>00665 {
<a name="l00666"></a>00666     <span class="keywordtype">bool</span> is_notification_mode    = <span class="keyword">false</span>;
<a name="l00667"></a>00667     <span class="keywordtype">bool</span> is_non_connectable_mode = <span class="keyword">false</span>;
<a name="l00668"></a>00668 
<a name="l00669"></a>00669     <a class="code" href="group__ble__sdk__app__gzll__ui.html#gacef6dd444cb6560da652897ee43ab306" title="Initialize GPIOTE module for detecting buttons.">buttons_init</a>();
<a name="l00670"></a>00670 
<a name="l00671"></a>00671     <span class="comment">// Check button states</span>
<a name="l00672"></a>00672     <span class="comment">// Notification Start button</span>
<a name="l00673"></a>00673     <span class="keywordflow">if</span> (<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8014b2b4745214caa69c5fddd0401388" title="Read the state of the input pin.">gpio_pin_read</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaaed671c6b234821122d1d5001f3c7070">NOTIF_BUTTON_PIN_NO</a>) == 0)    
<a name="l00674"></a>00674     {
<a name="l00675"></a>00675         is_notification_mode = <span class="keyword">true</span>;
<a name="l00676"></a>00676     }
<a name="l00677"></a>00677     <span class="comment">// Non-connectable advertisement start button</span>
<a name="l00678"></a>00678     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga8014b2b4745214caa69c5fddd0401388" title="Read the state of the input pin.">gpio_pin_read</a>(<a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga0ba1e5fcb6523111994123a3149aeabb">NON_CONN_ADV_BUTTON_PIN_NO</a>) == 0)
<a name="l00679"></a>00679     {
<a name="l00680"></a>00680         is_non_connectable_mode = <span class="keyword">true</span>;
<a name="l00681"></a>00681     }
<a name="l00682"></a>00682 
<a name="l00683"></a>00683     <span class="comment">// Initialize soft device</span>
<a name="l00684"></a>00684     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gaa06a7a39e83ec4cf3553f4ed6ba6323a" title="BLE stack initialization.">ble_stack_init</a>();
<a name="l00685"></a>00685 
<a name="l00686"></a>00686     <span class="keywordflow">if</span> (!is_notification_mode &amp;&amp; !is_non_connectable_mode)
<a name="l00687"></a>00687     {
<a name="l00688"></a>00688         uint32_t err_code;
<a name="l00689"></a>00689 
<a name="l00690"></a>00690         <span class="comment">// The startup was not because of button presses. This is the first start. </span>
<a name="l00691"></a>00691         <span class="comment">// Go into System-Off mode. Button presses will wake the chip up.</span>
<a name="l00692"></a>00692         err_code = <a class="code" href="group__nrf__soc__api.html#ga302701614c7bb1c9fc01dafec2bb04fb" title="Puts the chip in System OFF mode.">nrf_power_system_off</a>();  
<a name="l00693"></a>00693         <span class="keywordflow">if</span> (err_code != <a class="code" href="group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123" title="Successful command.">NRF_SUCCESS</a>)
<a name="l00694"></a>00694         {
<a name="l00695"></a>00695             <a class="code" href="nrf__assert_8h.html#a28301f76c53b643912da7c538f74e2c6" title="Assert empty when disabled.">ASSERT</a>(<span class="keyword">false</span>);
<a name="l00696"></a>00696         }
<a name="l00697"></a>00697     }
<a name="l00698"></a>00698     
<a name="l00699"></a>00699     <span class="comment">// If we reach this point, the application was woken up by pressing one of the two configured</span>
<a name="l00700"></a>00700     <span class="comment">// buttons.</span>
<a name="l00701"></a>00701 
<a name="l00702"></a>00702     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga09658aaa0774820d8f25249d551bc283" title="Timer initialization.">timers_init</a>();
<a name="l00703"></a>00703     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga1004973353f351806e42896c491a5ab2" title="GAP initialization.">gap_params_init</a>();
<a name="l00704"></a>00704 
<a name="l00705"></a>00705     <span class="keywordflow">if</span> (is_notification_mode)
<a name="l00706"></a>00706     {
<a name="l00707"></a>00707         <span class="comment">// Notification button is pressed. Start connectable advertisement.</span>
<a name="l00708"></a>00708         <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga934bcce661439fc90412ca1db063b4b7" title="Connectable advertisement parameters init function.">connectable_adv_init</a>();
<a name="l00709"></a>00709         <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gad49f9175444b3807f1656765165799a5" title="Service add function.">service_add</a>();
<a name="l00710"></a>00710     }
<a name="l00711"></a>00711     <span class="keywordflow">else</span>
<a name="l00712"></a>00712     {
<a name="l00713"></a>00713         <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga23b9d2f8790845fdf3dc42fefca65e85" title="Non-Connectable advertisement parameters init function.">non_connectable_adv_init</a>();
<a name="l00714"></a>00714     }
<a name="l00715"></a>00715     
<a name="l00716"></a>00716     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gae64bf38f2019810fa55bd7ceaa0d39e9" title="Advertisement paccket init function.">advertising_data_init</a>();
<a name="l00717"></a>00717     <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#gadf80cd84ee702e57a2a416fe4f653eb8" title="Start advertising.">advertising_start</a>();
<a name="l00718"></a>00718 
<a name="l00719"></a>00719     <span class="comment">// Enter main loop</span>
<a name="l00720"></a>00720     <span class="keywordflow">for</span> (;;)
<a name="l00721"></a>00721     {
<a name="l00722"></a>00722         <a class="code" href="group__ble__sdk__app__pwr__mgmt__main.html#ga3adda2642702fdb99b08992c39494000" title="Power manager.">power_manage</a>();
<a name="l00723"></a>00723     }
<a name="l00724"></a>00724 }
<a name="l00725"></a>00725 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="nrf6310__nrf2752_2ble_2ble__app__pwr__profiling_2main_8c.html">main.c</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
